from dpcDBs import settingsTable

import os
from sqlobject import *



class logTable( SQLObject ):
  # Simple type/message/time logging
  logType = StringCol( length = 1 )
  message = StringCol()
  timeStamp = DateTimeCol( default = DateTimeCol.now )


class log():
  @staticmethod
  def i( t, msg ):
    if settingsTable.getSettings().logging_i:
      logTable( logType = "i",
                message = type( t ).__name__ + ':' + msg )
  @staticmethod
  def w( t, msg ):
    if settingsTable.getSettings().logging_w:
      logTable( logType = "w",
                message = type( t ).__name__ + ':' + msg )
  @staticmethod
  def e( t, msg ):
    if settingsTable.getSettings().logging_e:
      logTable( logType = "e",
                message = type( t ).__name__ + ':' + msg )
